package com.tangjiali.nest;
/*需求：一个年级有若干个班级，每个班级有若干个学生；要求：

        1. 学生具有学号、姓名和成绩，学号和学生信息是一一对应的；
        2. 使用集合保存这个年级的所有学生的信息，然后遍历输出；
        思路：

        - 班级：Map<Integer,Student> 键：学号，值：学生对象
        - 年级：List<Map<Integer,Student>> 使用List集合将每个班级保存*/


import java.util.*;

public class Solution {
    public static void main(String[] args) {
       Student student1 = new Student("熊大",98);
        Student student2 = new Student("熊二",100);
       Student student3 = new Student("熊三",99);
       Student student4 = new Student("熊四",98);

        Map<Integer,Student> class1 = new HashMap<>();
        Map<Integer,Student> class2 = new HashMap<>();
        class1.put(1,student1);
        class1.put(2,student2);
        class2.put(3,student3);
        class2.put(4,student4);

        List<Map<Integer,Student>> grade = new ArrayList<>();
        grade.add(class1);
        grade.add(class2);

        System.out.println(grade);



    }
}


class Student{
    private String name;
    private double score;

    public Student() {
    }

    public Student(String name, double score) {
        this.name = name;
        this.score = score;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getScore() {
        return score;
    }

    public void setScore(double score) {
        this.score = score;
    }

    @Override
    public String toString() {
        return "{" +
                "name='" + name + '\'' +
                ", score=" + score +
                '}';
    }
}